﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace TripLOAMobile
{
    /// <summary>
    /// This class represent the criteria of a search.
    /// !!!DA RIVEDERE!!!
    /// </summary>
    public class SearchCriteria
    {
        private string departure, destination;
        private DateTime departureTime, destinationTime;
        private bool smoker;

        public string Departure
        {
            get
            {
                if (departure == null)
                    return "";
                else
                    return " departure = " + departure;
            }
            set 
            {
                departure = value;
            }
        }

        public string Destination
        {
            get
            {
                if (destination == null)
                    return "";
                else
                    return " destination = "+destination;
            }
            set
            {
                destination = value;
            }
        }

        public DateTime DepartureTime
        {
            get
            {
                return departureTime;
            }
            set
            {
                departureTime = value;
            }
        }

        public DateTime DestinationTime
        {
            get
            {
                return destinationTime;
            }
            set
            {
                destinationTime = value;
            }
        }
        
        /// <summary>
        /// If not specified, the passenger is considered a smoker.
        /// This is because normally a passenger that does not smoke is worried about if others passengers smokes.
        /// </summary>
        public bool Smoker
        {
            get
            {
                if(smoker==default(bool))
                    return true;
                else
                    return smoker;
            }
            set
            {
                smoker = value;
            }
        }

        /*
        /// <summary>
        /// This method transform the SearchCriteria in a String, omitting the fields not specified
        /// </summary>
        /// <returns> The string representing the object</returns>
        public string ToString()
        {
            string ret = Departure + Destination;
            if (DepartureTime != default(DateTime))
                ret += " departure time = " + DepartureTime;
            if (DestinationTime != default(DateTime))
                ret += " destination time = " + DestinationTime;
            if (Smoker)
                ret += " smoker ";
            else
                ret += " not smoker ";
            
            ret.Trim();
            return ret;
        }
        */
    }
}
